//
//  SISSEscrowUnfreezeViewModel.m
//  SISSAPP
//
//  Created by 袁应荣 on 2018/10/26.
//  Copyright © 2018年 优房网. All rights reserved.
//

#import "SISSEscrowUnfreezeViewModel.h"

@implementation SISSEscrowUnfreezeViewModel


- (NSString *)plistName {
    return @"EscrowUnfreezeInfoArray";
}


- (UIView *)getViewHeaderInSection:(NSInteger)section {
    
    SISSBaseView *headerView = [[SISSBaseView alloc] init];
    headerView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    UILabel *label = [[UILabel alloc] init];
    label.textColor = COLOR(0x334A60);
    label.font = [UIFont systemFontOfSize:16];
    [headerView addSubview:label];
    
    CGFloat margin = 8.0;
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(headerView).offset(2 * margin);
        make.centerY.equalTo(headerView);
    }];
    
    NSArray *headerTextArr = @[@"", @""];
    
    label.text = headerTextArr[section];
    
    return headerView;
}


- (CGFloat)getHeightForHeaderInSection:(NSInteger)section {
    if (section == 0) {
        return 0.001;
    }
    return 16;
}

- (SISSEscrowTrawInfoModel *)dataArrToEscrowTrawInfoModel {
    SISSEscrowTrawInfoModel *model = [[SISSEscrowTrawInfoModel alloc] init];
    model.thawState = self.dataArr[0][0].rightStr;
    model.thawWay = self.dataArr[0][1].rightStr;
    model.thawTime = self.dataArr[0][2].rightStr;
    model.interestProcess = self.dataArr[0][3].rightStr;
    model.otherdesc = self.dataArr[1][0].rightStr;
    return model;
}

- (void)assignmentWithEscrowTrawInfoModel:(SISSEscrowTrawInfoModel *)escrowTrawInfoModel {
    NSDictionary *infoDict = [escrowTrawInfoModel yy_modelToJSONObject];
    for (NSInteger section = 0; section < self.dataArr.count; section++) {
        
        for (NSInteger idx = 0; idx < self.dataArr[section].count; idx++) {
            
            SISSContractModel *obj = self.dataArr[section][idx];
            obj.rightStr = infoDict[obj.propertyKey] != nil ? [NSString stringWithFormat:@"%@",infoDict[obj.propertyKey]] : @"";
        }
    }
    [self.tableView reloadData];
}

@end
